package com.ruoyi.product.controller;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.product.service.TbTypeService;
import com.ruoyi.product.vo.TbProduct;
import com.ruoyi.product.vo.TbType;
import com.ruoyi.system.api.model.PageInfoVo;
import com.ruoyi.system.api.model.ProductInfoVo;
import com.ruoyi.system.api.model.TypeInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 轩
 * @version 1.0
 * @description: TODO
 * @date 2023/1/16 14:06
 */

@RestController
@RequestMapping(value = "/type")
@Slf4j
public class TypeController {

    @Autowired
    TbTypeService tbTypeService;


    /**
     * 列表查询
     */
    @PostMapping(value = "/list")
    public AjaxResult list(@RequestBody PageInfoVo pageInfoVo){



        return tbTypeService.list(pageInfoVo);
    }

    @PostMapping(value = "/typelist")
    public AjaxResult typelist(){



        return tbTypeService.typelist();
    }


    /**
     * 添加
     * @return
     */
    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody TbType tbType){


        return tbTypeService.add(tbType);
    }

    /**
     * 删除
     */
    @PostMapping(value = "deleteById")
    public AjaxResult deleteById(Integer id){
        return tbTypeService.deleteById(id);
    }

    /**
     * 修改
     */
    @PostMapping(value = "updateById")
    public  AjaxResult updateById(@RequestBody TypeInfoVo typeInfoVo){
        return tbTypeService.updateById(typeInfoVo);
    }
}
